package com.aaa.depression.service;


import com.aaa.depression.dao.DepressionDao;
import com.aaa.pojo.Page;
import com.aaa.pojo.ResultBean;
import com.aaa.pojo.question_fpa;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepressionServiceimpl implements DepressionService{
    @Autowired
    private DepressionDao depressionDao;
    @Override
    public ResultBean findAll(Page page, question_fpa question) {

        PageHelper.startPage(page.getPage(), page.getLimit());

        //查数据

        List<question_fpa> list = depressionDao.findAll(question);

        /* System.out.println("data"+list);*/

        PageInfo<question_fpa> pageInfo=new PageInfo<question_fpa>(list);

        return new ResultBean(0,"查询成功",pageInfo.getTotal(),pageInfo.getList());

    }
    @Override
    public Integer delete (@Param("id") Integer id ) {
        return depressionDao.delete(id);
    }

    @Override
    public Integer deletes(@Param("id") Integer[] id) {
        return depressionDao.deletes(id);
    }

    @Override
    public Integer save(question_fpa question_fpa) {
        return depressionDao.save(question_fpa);
    }

    @Override
    public Integer update(question_fpa question_fpa) {
        return depressionDao.update(question_fpa);
    }


}
